package com.city.repository.party;

import com.city.domain.party.PartyBranch;
import com.city.domain.party.PartyMembership;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface PartyMembershipRepository extends JpaRepository<PartyMembership,Integer>{

    //分页查询
    @Query(value = "select * from party_membership limit ?1,?2",nativeQuery = true)
    List<PartyMembership> findAllByPage(Integer page, Integer limit);

    //模糊查询
    //模糊查询
    @Query(value = "select * from party_membership  where name like %?1%  limit ?2,?3",nativeQuery = true)
    List<PartyMembership> findAllByNameAndPage(String branchName, Integer page, Integer limit);

    //根据人员名类别统计记录数
    @Query(value = "SELECT count(*) from party_membership where name like %?1%",nativeQuery = true)
    long countName(String name);
}
